﻿App.Rollback = function() {
    return {

        currentFormValues: {},

        getStore: function() {
            var store = new Ext.data.Store({
                autoLoad:true,
				baseParams : {start:0, limit:25},
				proxy: new Ext.data.HttpProxy({
					url : 'rollback/items'
				}),
                remoteSort: false,
				reader: new Ext.data.JsonReader({
					totalProperty : 'totalCount',
					root : 'rows',
					idProperty : 'object_id',
					fields: [{
						name: 'object_id',
						type: 'string'
					},{
						name: 'objid',
						type: 'string'
					},
					{
						name:'obj_name',
						type:'string'
					},
					{
						name:'obj_num',
						type:'string'
					},
					{
						name: 'from_addr',
						allowBlank: false
					},
					{
						name: 'to_addr',
						allowBlank: false
					},
					{
						name: 'from_name',
						allowBlank: false
					},
					{
						name: 'to_name',
						allowBlank: false
					},
					{
						name:'from_tell'
					},
					{
						name: "to_tell"
					},
					{
						name: "op_time",
						type: 'date',
						dateFormat: 'time'
					},
					{
						name:"cost_id"
					},
					{
						name:"cost_type"
					},
					{
						name: "traff_fee"
					},
					{
						name: "mid_fee"
					},
					{
						name: "oth_fee"
					},
					{
						name: "inst_fee"
					},
					{
						name:"pre_fee"
					},
					{
						name: "saf_fee"
					},{
						name:"send_type"
					}]
				})
            });
            return store;
        },



        submit: function() {
            if (this.form.getForm().isValid()) {
                this.form.getForm().submit({
                    waitTitle: '保存数据',
                    waitMsg: '正在保存……',
                    scope: this,
                    method: 'post',
                    params: '',
                    success: function(form, action) {
                       var info = action.result.info;
                        if (action.result.success) {
                            if (action.result.method == "Create") {
                                this.form.getForm().reset();
                            } else {
                                this.dlg.hide();
                            }
                        }
                        Ext.Msg.alert('信息', info);
                    },
                    failure: function(form, action) {
                        var info = action.result.info;
	    				Ext.Msg.alert('提示', info);
                    }
                });
            }
        },


        createGrid: function(id) {

            var panel = Ext.getCmp(id);

            panel.body.dom.innerHTML = "";

            var sm = new Ext.grid.CheckboxSelectionModel();
            this.grid = new Ext.grid.GridPanel({
            	anchor:'top 50%',
                loadMask: true,
                stripeRows: true,
                tbar: new Ext.PagingToolbar({ 
                	pageSize: 20 ,//分页必须加的参数.最好和store里面的limit保持一致
                	displayInfo: true,
                    store: this.store,
                    items:[
                /*    {
	                    text: '增加',
	                    scope: this,
	                    handler: this.add
	                },
	              */ {
	                    text: '发货',
	                    scope: this,
	                    handler: this.edit
	                },
	                /*{
	                    text: '删除',
	                    scope: this,
	                    handler: this.del
                },
                */'-', new Ext.ux.form.SearchField({
                    store: this.store,
                    width: 110
                })]}),
                title:"发货管理",//打印必须设置tile
                plugins: [Ext.ux.plugins.Print],//打印按钮
                loadMask: true,
                viewConfig : {autoFill:false,forceFit:true},
                autoHeight:true,
                store: this.store,
                sm: sm,
                columns: [sm,new Ext.grid.RowNumberer(), {
                    header: "货号",
                    width: 60,
                    sortable: true,
                    dataIndex: 'objid',
                    renderer: this.highLight
                },
               {
                    header: "货名",
                    width: 100,
                    sortable: true,
                    dataIndex: 'obj_name',
                    renderer: this.highLight
                },
                {
                    header: "件数",
                    width: 100,
                    sortable: true,
                    dataIndex: 'obj_num',
                    renderer: this.highLight
                },
       /*      {
                    header: "发货人",
                    width: 100,
                    sortable: true,
                    dataIndex: 'from_name',
                    renderer: this.highLight
                },
            */    {
                    header: "收货人",
                    width: 100,
                    sortable: true,
                    dataIndex: 'to_name',
                    renderer: this.highLight
                },
       /*         {
                    header: "发货人电话",
                    width: 100,
                    sortable: true,
                    dataIndex: 'from_tell'
                },
         */       {
                    header: "收货人电话",
                    width: 100,
                    sortable: true,
                    dataIndex: 'to_tell'
                },
         /*       {
                    header: "入库时间",
                    width: 150,
                    sortable: true,
                    dataIndex: 'op_time',
                    renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s')
                },
           */     {
                	header: "付款方式",
                    width: 150,
                    sortable: true,
                    dataIndex: 'cost_type'
                },
                {
                	header:"发货方式",
                	width:150,
                	sortable:true,
                	dataIndex:'send_type'
                },
                {
                    header: "运费",
                    width: 150,
                    sortable: true,
                    dataIndex: 'traff_fee'
                },
                {
                    header: "中转费",
                    width: 150,
                    sortable: true,
                    dataIndex: 'mid_fee'
                },
                {
                    header: "保险费",
                    width: 150,
                    sortable: true,
                    dataIndex: 'saf_fee'
                },
                {
                    header: "代收",
                    width: 150,
                    sortable: true,
                    dataIndex: 'inst_fee'
                },
                { 
                	header: "垫付",
                    width: 150,
                    sortable: true,
                	dataIndex:'pre_fee'
                },
                {
                    header: "其它费",
                    width: 150,
                    sortable: true,
                    dataIndex: 'oth_fee'
                }]
            });
            panel.add(this.grid);

        },
        getForm: function() {
        	var staffStore = new Ext.data.Store({
            	autoLoad:false,
//				baseParams:{start:0, limit:23},
				proxy: new Ext.data.HttpProxy({
					url : 'user/users'
				}),
                remoteSort: false,
                reader: new Ext.data.JsonReader({
					totalProperty : 'totalCount',
					root : 'rows',
					idProperty : 'staff_id',
					fields: [{
						name: 'staff_id',
						type: 'string'
					},
					{
						name: 'name',
						type: 'string'
					}]
				})
            });
        	var transitStore = new Ext.data.Store({
            	autoLoad:false,
//				baseParams:{start:0, limit:23},
				proxy: new Ext.data.HttpProxy({
					url : 'transit/items'
				}),
                remoteSort: false,
                reader: new Ext.data.JsonReader({
					totalProperty : 'totalCount',
					root : 'rows',
					idProperty : 'transit_id',
					fields: [{
						name: 'transit_id',
						type: 'string'
					},
					{
						name: 'name',
						type: 'string'
					}]
				})
            });
        	 var getCostTypeStore = new Ext.data.Store({
                 autoLoad:false,
 				baseParams : {parent_id:1},//1表示direct表id为1的记录(次store取出parent为1的所有记录)
 				proxy: new Ext.data.HttpProxy({
 					url : 'menu/costype'
 				}),
                 remoteSort: false,
 				reader: new Ext.data.JsonReader({
 					totalProperty : 'totalCount',
 					root : 'rows',
 					idProperty : 'id',
 					fields: [{
 						name: 'name',
 						type:'string'
 					},{
 						name: 'id',
 						type: 'string'
 					}]
 				})
             });
            var form = new Ext.form.FormPanel({
            	url:'rollback/manager',
                labelAlign: 'right',
                frame: true,
                waitMsgTarget:true,
                defaults:{allowBlank :false},
                items: [{
                    layout:'column',
                    items:[{
                    	name:"id",
                    	hidden:true,
                    	value:' '
                    },{
                        columnWidth:.5,
                        layout: 'form',
                        defaults:{allowBlank :false},
                        defaultType : 'textfield',
                        				items : [
                    	                		{
                    	                			name: 'objid',
                    	                			fieldLabel: '货号'
                    	                		},
                    	                		{
                    	                			name: 'obj_name',
                    	                			fieldLabel: '货名'
                    	                		},
                    	                		{
                    	                			name: 'traff_fee',
                    	                			fieldLabel: '运费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		},
                    	                		{
                    	                			name: 'mid_fee',
                    	                			fieldLabel: '中转费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		},
                    	                		{
                    	                			name: 'saf_fee',
                    	                			fieldLabel: '保险费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		},
                    	                		{
                    	                			name: 'inst_fee',
                    	                			fieldLabel: '代收费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		},
                    	                		{
                    	                			name: 'oth_fee',
                    	                			fieldLabel: '其它费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		},
                    	                		{
                    	                			name:'pre_fee',
                    	                			fieldLabel:'垫付费',
                    	                			xtype : 'numberfield',
                    	                            value:0,
                    	                            minValue:0
                    	                		}]
                    },{
                    	defaults:{allowBlank :false},
                        columnWidth:.5,
                        layout: 'form',
                        defaultType : 'textfield',
                        				items : [
                        			        		{
                        			            		xtype: 'combo',
                        			            		fieldLabel:"付款方式",
                        			        			name: 'cost_type',
                        			        			width:130,
                        			        			store :getCostTypeStore,
                        			        			 displayField:'name',
                        			                     valueField :'id',
                        			                     mode: 'remote',
                        			                     triggerAction: 'all',
                        			                     editable: false,
                        			                     emptyText:'选择付款方式....'
                        			        		},
                        	                		{
                        	                			name: 'obj_num',
                        	                			fieldLabel: '件数',
                        	                			xtype : 'numberfield'
                        	                		},
                        	                		{
                        	                		//	xtype: 'textfield',
                        	                			name: 't_traff_fee',
                        	                			fieldLabel: '实收',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                	//		xtype: 'textfield',
                        	                			name: 't_mid_fee',
                        	                			fieldLabel: '实收',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                	//		xtype: 'textfield',
                        	                			name: 't_saf_fee',
                        	                			fieldLabel: '实收',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                	//		xtype: 'textfield',
                        	                			name: 't_inst_fee',
                        	                			fieldLabel: '实收',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                	//		xtype: 'textfield',
                        	                			name: 't_oth_fee',
                        	                			fieldLabel: '实收',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                			name:'t_pre_fee',
                        	                			fieldLabel:'垫付费',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0,
                        	                            listeners : {  //监听
                                    						change: function() {
                                    		                        var t_traff_fee = parseFloat(this.findParentByType('form').getForm().findField('t_traff_fee').getValue());
                                    		                        var t_mid_fee = parseFloat(this.findParentByType('form').getForm().findField('t_mid_fee').getValue());
                                    		                        var t_saf_fee = parseFloat(this.findParentByType('form').getForm().findField('t_saf_fee').getValue());
                                    		                        var t_inst_fee = parseFloat(this.findParentByType('form').getForm().findField('t_inst_fee').getValue());
                                    		                        var t_oth_fee = parseFloat(this.findParentByType('form').getForm().findField('t_oth_fee').getValue());
                                    		                        var t_pre_fee = parseFloat(this.findParentByType('form').getForm().findField('t_pre_fee').getValue());
                                    		                        this.findParentByType('form').getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                                    		                    }
                                    		                }
                        	                		},
                        	                		{
                        	                	//		xtype: 'textfield',
                        	                			name: 't_all_fee',
                        	                			fieldLabel: '汇总',
                        	                			xtype : 'numberfield',
                        	                            value:0,
                        	                            minValue:0
                        	                		}]
                    }]
                },
                {
                	xtype: 'hidden',
                	name:'cost_id'
                	
                },
                {
                	xtype: 'hidden',
                	name:'object_id'
                	
                },{
                	xtype: 'radiogroup', 
                    fieldLabel: '是否结清',
                    items : [
                             {
            					boxLabel: '是',
            					name: 'settle',
            					inputValue:1,
            					checked : true
                             },
                             {
                                 boxLabel: '否',
                                 name: 'settle',
                                 inputValue:0
                             }
                          ] 
                },
                {
                	xtype: 'radiogroup', 
                    fieldLabel: '是否中转',
                    items : [
                             {
            					boxLabel: '是',
            					name: 'transitf',
            					inputValue:1
            					
                             },
                             {
                                 boxLabel: '否',
                                 name: 'transitf',
                                 inputValue:0,
                                 checked : true,
                                 listeners : {
                                     check : function(checkbox, checked) {
                                          if (checked) {
                                        	  this.findParentByType('form').getForm().findField('transit_id').setDisabled(true);//选中报价金额输入框不可用
                                          }else{
                                        	  this.findParentByType('form').getForm().findField('transit_id').setDisabled(false);
                                          }
                                     }
                                }
                             }
                          ] 
                },
                {
                	
                	fieldLabel: '中转公司',
            		xtype:'combo',
            		disabled:true,
            		hiddenName :"transit_id",
            		store: transitStore,
                    displayField:'name',
                    valueField :'transit_id',
                    typeAhead: true,
                    mode: 'remote',
                    forceSelection: true,
                    triggerAction: 'all',
                    emptyText:'请选择中转公司...',
                    selectOnFocus:true,
                    editable: false
                	
            },
            {
            	xtype: 'radiogroup', 
                fieldLabel: '余货返回',
                items : [
                         {
        					boxLabel: '是',
        					name: 'returnf',
        					inputValue:1
        					
                         },
                         {
                             boxLabel: '否',
                             name: 'returnf',
                             inputValue:0,
                             checked : true
                         }
                      ] 
            }], 
            buttons: [{
                    text: '确定',
                    scope: this,
                    handler: function() {
                        this.submit();
                    }
                },
                {
                    text: '重置',
                    scope: this,
                    handler: function() {
                        var f = this.form.getForm();
                        f.reset();
                        f.setValues(this.currentFormValues);
                        f.clearInvalid();
                    }
                }]
            });
            
            return form;
        },
        getDialog: function() {
            var dlg = new Ext.Window({
                width: 550,
                height: 430,
                maximized:true,
                title: '',
                plain: true,
                closable: true,
                resizable: false,
                frame: true,
                layout: 'fit',
                closeAction: 'hide',
                border: false,
                modal: true,
                items: [this.form],
                listeners: {
                    scope: this,
                    render: function(fp) {
                        this.form.getForm().waitMsgTarget = fp.getEl();
                    },
                    show: function() {
                        var f = this.form.getForm();
                        f.setValues(this.currentFormValues);

                        var t_traff_fee = parseFloat(this.form.getForm().findField('t_traff_fee').getValue());
                        var t_mid_fee = parseFloat(this.form.getForm().findField('t_mid_fee').getValue());
                        var t_saf_fee = parseFloat(this.form.getForm().findField('t_saf_fee').getValue());
                        var t_inst_fee = parseFloat(this.form.getForm().findField('t_inst_fee').getValue());
                        var t_oth_fee = parseFloat(this.form.getForm().findField('t_oth_fee').getValue());
                        var t_pre_fee = parseFloat(this.form.getForm().findField('t_pre_fee').getValue());
                        this.form.getForm().findField('t_all_fee').setValue(Number(t_traff_fee+t_mid_fee+t_saf_fee+t_inst_fee+t_oth_fee+t_pre_fee));
                    
                        f.clearInvalid();
                    },
                    beforehide: function(){
                    	this.store.reload();
                    }
                }
            });
            return dlg;
        },
        highLight: function(value) {
        	var key = App.Rollback.grid.store.baseParams.query;
        	var v = value ? value.toString() : '';
        	if (Ext.isString(v) & Ext.isString(key)) {
        		if (key.length > 0) {
        			var re = new RegExp(key, "g");
        			return v.replace(re, "<span style='color:red;background-color:yellow;'>" + key + "</span>");
        		} else {
        			return v;
        		}
        	} else {
        		return v;
        	}
        },
        add: function() {
            Ext.apply(this.currentFormValues, {
            	object_id: '',
                objid: "",
                obj_name: "",
                obj_num: 1,
                from_name: "",
                from_addr: "",
                from_tell: "",
                to_name: "",
                to_addr: "",
                to_tell: "",
                traff_fee:0,
                inst_fee:0,
                mid_fee:0,
                oth_fee:0,
                ppice:0,
                price:0,
                cost_type:'',
                sign_staff_id:"",
                transit_id:'',
                transitf:0,
                brief:""
            });
            this.dlg.setTitle("增加货号");
            this.dlg.show();
        },

        edit: function() {
            if (this.grid.getSelectionModel().hasSelection()) {
                this.dlg.setTitle("编辑货号");
                var rec = this.grid.getSelectionModel().getSelected();
                Ext.apply(this.currentFormValues, {
                	object_id:rec.json.object_id,
                	objid:rec.json.objid,
                	saf_fee:rec.json.saf_fee,
                	mid_fee:rec.json.mid_fee,
                	traff_fee:rec.json.traff_fee,
                	inst_fee:rec.json.inst_fee,
                	oth_fee:rec.json.oth_fee,
                	t_saf_fee:rec.json.saf_fee,
                	t_mid_fee:rec.json.mid_fee,
                	t_traff_fee:rec.json.traff_fee,
                	t_inst_fee:rec.json.inst_fee,
                	t_oth_fee:rec.json.oth_fee,
                	t_pre_fee:rec.json.pre_fee,
                	cost_id:rec.json.cost_id,
                	cost_type:rec.json.cost_type,
                	obj_name:rec.json.obj_name,
                	obj_num:rec.json.obj_num
                	
                });
                this.dlg.show();
            } else {
                Ext.Msg.alert('信息', '请选择要编辑的货号。');
            }
        },

        del: function() {
            if (this.grid.getSelectionModel().hasSelection()) {
                var recs = this.grid.getSelectionModel().getSelections();
                var ids = [];
                var titles = '';
                for (var i = 0; i < recs.length; i++) {
                    var data = recs[i].data;
                    ids.push(data.object_id);
                    titles += data.objid + '<br>';
                }
                Ext.Msg.confirm('删除用户', '确定删除货号？<br><font color="red">' + titles + '</font>',
                function(btn) {
                    if (btn == 'yes') {
						Ext.Ajax.request({
							method:'post',
							url:'inhouse/remove',
							params:{
								ids:ids.toString()
							},
							success: function(resp, opts) {
								var result = Ext.util.JSON.decode(resp.responseText);
								var info = result.info;
								if(result.success=='true') {
									Ext.Msg.alert('信息', info);
                                    App.In.store.reload();
								}else {
                                    Ext.Msg.alert('信息', info);
                                }
							},
							failure: function(resp,opts) {
								var result = Ext.util.JSON.decode(resp.responseText);
								var info = result.info;
								Ext.Msg.alert('提示', info); 
							}
						});
                    }
                });
            } else {
                Ext.Msg.alert('信息', '请选择要删除的用户！');
            }
        },


        render: function(id) {
            if (!this.store) {
                this.store = this.getStore();
            };
            if (!this.form) {
                this.form = this.getForm();
            };
            if (!this.dlg) {
                this.dlg = this.getDialog();
            };
            this.createGrid(id);

        }
    };
} ();
